package com.xishu.entity.order;

import com.xishu.annotation.dao.DefaultValue;
import com.xishu.annotation.lang.Lang;
import com.xishu.entity.shop.ItemDetail;
import com.xishu.entity.shop.SetMenuOneItem;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class OrderItem implements Serializable {
    private static final long serialVersionUID = 2434605786964607780L;

    @ApiModelProperty(value = "ID")
    private Long id;

    @ApiModelProperty(value = "菜品ID")
    private Long itemId;

    @ApiModelProperty(value = "主菜的ID")
    private Long mainItemId;

    @ApiModelProperty(value = "菜品图片")
    private String itemImgUrl;

    @ApiModelProperty(value = "打印标签")
    private String printLabel;

    @ApiModelProperty(value = "菜品数量")
    private Integer count;

    @ApiModelProperty(value = "已付钱的数量")
    private Integer payNumber;

    @ApiModelProperty(value = "菜品")
    @Lang(key = "itemName")
    private String itemName;

    @ApiModelProperty(value = "菜品")
    @Lang(key = "itemName")
    private String itemName_zh;

    @ApiModelProperty(value = "菜品")
    @Lang(key = "itemName")
    private String itemName_en;

    @ApiModelProperty(value = "菜品价格")
    private Double itemPrice;

    @ApiModelProperty(value = "菜品价格基础价格,为了套餐使用")
    private Double basePrice;

    @ApiModelProperty(value = "菜品总的消费")
    private Double itemTotalCost;

    @ApiModelProperty(value = "菜品所属的品类")
    private Long catalogId;

    @ApiModelProperty(value = "品类")
    private String catalogName;

    @ApiModelProperty(value = "品类中文")
    private String catalogName_zh;

    @ApiModelProperty(value = "品类英文")
    private String catalogName_en;

    @Transient
    @ApiModelProperty(value = "菜品的规格")
    private List<ItemDetail> itemDetailList = new ArrayList<>();

    @ApiModelProperty(value = "菜品的规格")
    private String detailJson;

    @ApiModelProperty(value = "备注")
    private String remarks;

    @ApiModelProperty(value = "是否是外卖")
    private Boolean takeout;

    @ApiModelProperty(value = "是否是套餐")
    private Boolean setMenu;

    @ApiModelProperty(value = "套餐里面的菜品名称")
    private List<SetMenuOneItem> setMenuOneItemList;

    @Transient
    @ApiModelProperty(value = "是否要从购物车里面删除")
    private Boolean delete;

    @ApiModelProperty(value = "是否是C端添加")
    private Boolean customerAdd;

    @ApiModelProperty(value = "是否已经点了结算")
    private Boolean checkout;

    @ApiModelProperty(value = "是否在B端已确认")
    private Boolean confirmItem;

    @ApiModelProperty(value = "是否已经锁定了菜品")
    private Boolean lockItem;

    @ApiModelProperty(value = "加菜时的场景ID,如果传了那么用该场景去计算价格，如果没有传，根据当前时间来计算价格")
    private Long sceneId;

    @ApiModelProperty(value = "已经打折的个数")
    private int discountNumber;

    @ApiModelProperty(value = "将菜品排除在外卖折扣外卖里面")
    private Boolean excludeTakeOutDiscount;

    @ApiModelProperty(value = "将菜品排除在服务费的计算里面")
    private Boolean excludeServiceFee;

    @ApiModelProperty(value = "将菜品排除在优惠券折扣里面")
    private Boolean excludeDiscountTicket;

    @ApiModelProperty(value = "是否可以发送到厨房")
    @DefaultValue(defaultValue = "true")
    private Boolean canSendToKitchen;

    @ApiModelProperty(value = "报表里面的值")
    private Double reportValue;

    @ApiModelProperty(value = "更新价格")
    private Boolean updatePrice;

    public Boolean getUpdatePrice() {
        return updatePrice;
    }

    public void setUpdatePrice(Boolean updatePrice) {
        this.updatePrice = updatePrice;
    }

    public Double getReportValue() {
        return reportValue;
    }

    public void setReportValue(Double reportValue) {
        this.reportValue = reportValue;
    }

    public Boolean getCanSendToKitchen() {
        return canSendToKitchen;
    }

    public void setCanSendToKitchen(Boolean canSendToKitchen) {
        this.canSendToKitchen = canSendToKitchen;
    }

    public Boolean getExcludeServiceFee() {
        return excludeServiceFee;
    }

    public void setExcludeServiceFee(Boolean excludeServiceFee) {
        this.excludeServiceFee = excludeServiceFee;
    }

    public Boolean getExcludeDiscountTicket() {
        return excludeDiscountTicket;
    }

    public void setExcludeDiscountTicket(Boolean excludeDiscountTicket) {
        this.excludeDiscountTicket = excludeDiscountTicket;
    }

    public Boolean getExcludeTakeOutDiscount() {
        return excludeTakeOutDiscount;
    }

    public void setExcludeTakeOutDiscount(Boolean excludeTakeOutDiscount) {
        this.excludeTakeOutDiscount = excludeTakeOutDiscount;
    }

    public Boolean getConfirmItem() {
        return confirmItem;
    }

    public void setConfirmItem(Boolean confirmItem) {
        this.confirmItem = confirmItem;
    }

    public int getDiscountNumber() {
        return discountNumber;
    }

    public void setDiscountNumber(int discountNumber) {
        this.discountNumber = discountNumber;
    }

    public Long getMainItemId() {
        return mainItemId;
    }

    public void setMainItemId(Long mainItemId) {
        this.mainItemId = mainItemId;
    }

    public Long getSceneId() {
        return sceneId;
    }

    public void setSceneId(Long sceneId) {
        this.sceneId = sceneId;
    }

    public Boolean getLockItem() {
        return lockItem;
    }

    public void setLockItem(Boolean lockItem) {
        this.lockItem = lockItem;
    }

    public Boolean getCustomerAdd() {
        return customerAdd;
    }

    public void setCustomerAdd(Boolean customerAdd) {
        this.customerAdd = customerAdd;
    }

    public Boolean getCheckout() {
        return checkout;
    }

    public void setCheckout(Boolean checkout) {
        this.checkout = checkout;
    }

    public Boolean getTakeout() {
        return takeout;
    }

    public void setTakeout(Boolean takeout) {
        this.takeout = takeout;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public Boolean getDelete() {
        return delete;
    }

    public void setDelete(Boolean delete) {
        this.delete = delete;
    }

    public List<ItemDetail> getItemDetailList() {
        return itemDetailList;
    }

    public void setItemDetailList(List<ItemDetail> itemDetailList) {
        this.itemDetailList = itemDetailList;
    }

    public String getDetailJson() {
        return detailJson;
    }

    public void setDetailJson(String detailJson) {
        this.detailJson = detailJson;
    }

    public Long getCatalogId() {
        return catalogId;
    }

    public void setCatalogId(Long catalogId) {
        this.catalogId = catalogId;
    }

    public String getCatalogName() {
        return catalogName;
    }

    public void setCatalogName(String catalogName) {
        this.catalogName = catalogName;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public Double getItemPrice() {
        return itemPrice;
    }

    public void setItemPrice(Double itemPrice) {
        this.itemPrice = itemPrice;
    }

    public Double getItemTotalCost() {
        return itemTotalCost;
    }

    public void setItemTotalCost(Double itemTotalCost) {
        this.itemTotalCost = itemTotalCost;
    }

    public Long getItemId() {
        return itemId;
    }

    public void setItemId(Long itemId) {
        this.itemId = itemId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getPayNumber() {
        return payNumber;
    }

    public void setPayNumber(Integer payNumber) {
        this.payNumber = payNumber;
    }

    public String getItemImgUrl() {
        return itemImgUrl;
    }

    public void setItemImgUrl(String itemImgUrl) {
        this.itemImgUrl = itemImgUrl;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof OrderItem)) {
            return false;
        }
        OrderItem orderItem = (OrderItem) o;
        return Objects.equals(itemId, orderItem.itemId) &&
                Objects.equals(takeout, orderItem.takeout) &&
                Objects.equals(remarks, orderItem.remarks) &&
                Objects.equals(itemDetailList, orderItem.itemDetailList) &&
                Objects.equals(setMenuOneItemList, orderItem.setMenuOneItemList);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, itemDetailList, setMenuOneItemList);
    }

    public List<SetMenuOneItem> getSetMenuOneItemList() {
        return setMenuOneItemList;
    }

    public void setSetMenuOneItemList(List<SetMenuOneItem> setMenuOneItemList) {
        this.setMenuOneItemList = setMenuOneItemList;
    }

    public String getPrintLabel() {
        return printLabel;
    }

    public void setPrintLabel(String printLabel) {
        this.printLabel = printLabel;
    }

    public String getItemName_zh() {
        return itemName_zh;
    }

    public void setItemName_zh(String itemName_zh) {
        this.itemName_zh = itemName_zh;
    }

    public String getItemName_en() {
        return itemName_en;
    }

    public void setItemName_en(String itemName_en) {
        this.itemName_en = itemName_en;
    }

    public Double getBasePrice() {
        return basePrice;
    }

    public void setBasePrice(Double basePrice) {
        this.basePrice = basePrice;
    }

    public Boolean getSetMenu() {
        return setMenu;
    }

    public void setSetMenu(Boolean setMenu) {
        this.setMenu = setMenu;
    }

    public String getCatalogName_zh() {
        return catalogName_zh;
    }

    public void setCatalogName_zh(String catalogName_zh) {
        this.catalogName_zh = catalogName_zh;
    }

    public String getCatalogName_en() {
        return catalogName_en;
    }

    public void setCatalogName_en(String catalogName_en) {
        this.catalogName_en = catalogName_en;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("OrderItem{");
        sb.append("id=").append(id);
        sb.append(", itemId=").append(itemId);
        sb.append(", mainItemId=").append(mainItemId);
        sb.append(", itemImgUrl='").append(itemImgUrl).append('\'');
        sb.append(", printLabel='").append(printLabel).append('\'');
        sb.append(", count=").append(count);
        sb.append(", payNumber=").append(payNumber);
        sb.append(", itemName='").append(itemName).append('\'');
        sb.append(", itemName_zh='").append(itemName_zh).append('\'');
        sb.append(", itemName_en='").append(itemName_en).append('\'');
        sb.append(", itemPrice=").append(itemPrice);
        sb.append(", basePrice=").append(basePrice);
        sb.append(", itemTotalCost=").append(itemTotalCost);
        sb.append(", catalogId=").append(catalogId);
        sb.append(", catalogName='").append(catalogName).append('\'');
        sb.append(", catalogName_zh='").append(catalogName_zh).append('\'');
        sb.append(", catalogName_en='").append(catalogName_en).append('\'');
        sb.append(", itemDetailList=").append(itemDetailList);
        sb.append(", detailJson='").append(detailJson).append('\'');
        sb.append(", remarks='").append(remarks).append('\'');
        sb.append(", takeout=").append(takeout);
        sb.append(", setMenu=").append(setMenu);
        sb.append(", setMenuOneItemList=").append(setMenuOneItemList);
        sb.append(", delete=").append(delete);
        sb.append(", customerAdd=").append(customerAdd);
        sb.append(", checkout=").append(checkout);
        sb.append(", confirmItem=").append(confirmItem);
        sb.append(", lockItem=").append(lockItem);
        sb.append(", sceneId=").append(sceneId);
        sb.append(", discountNumber=").append(discountNumber);
        sb.append(", excludeTakeOutDiscount=").append(excludeTakeOutDiscount);
        sb.append(", excludeServiceFee=").append(excludeServiceFee);
        sb.append(", excludeDiscountTicket=").append(excludeDiscountTicket);
        sb.append(", canSendToKitchen=").append(canSendToKitchen);
        sb.append('}');
        return sb.toString();
    }
}
